﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Way.Bus.WMS.Controllers;
using Way.Bus.WMS.Model;
using Way.Contract.MVC;

namespace Way.Bus.Wms.Controllers.BusinessLogic
{
    /// <summary>
    /// 借货控制器
    /// </summary>
    public class ConductioController : StockOutOrderController
    {
         public ConductioController() : base(new StockOutOrder()) { }
         public ConductioController(IModel model) : base(model) { }

         protected override int StockType()
         {
             return 1;
         }
         protected override string SubmitName
         {
             get
             {
                 return "借货转销售";
             }
         }
         protected override void OnInitViewChildItem(Way.Contract.Data.ModelData data, Way.Contract.Data.ItemData item)
         {
             base.OnInitViewChildItem(data, item);
             if (data.name.EndsWith("StockOutNoticeMaterials"))
                 data.visible = false;
             if (data.name.EndsWith("StockOutOrder"))
             {
                 data.title = "借货单";
                 if(item.IsField("sourcecode"))
                     item.visible=false;
                 if (item.IsField("code"))
                 {
                     item.title = "借货单号";
                     item.disabled = true;
                 }
                 if (item.IsField("towhno"))
                     item.title = "借货仓库";
                 if (item.IsField("CLIENTNO"))
                     item.title = "借货单位";
                 if (item.IsField("WORKERID"))
                     item.title = "借货负责人";
                 if (item.IsField("STAY3"))
                 {
                     item.visible = true;
                     item.title = "借货人";
                 }
                 if(item.IsField("SOURCENAME")||item.IsField("SOURCEOUTCODE")||
                     item.IsField("INOUTTIME") || item.IsField("LOGCODE") || item.IsField("STOCKTYPE")
                     || item.IsField("STATE"))
                     item.visible=false;
                 if (item.IsField("FINISHTIME"))
                     item.title = "预计还货日期";
             }
             if (data.name.EndsWith("StockOutOrderMaterials"))
             {
                 data.title = "借货明细";
             }
         }
    }
}
